<template>
  <view class="content">    
    <view @click="hqCode">登录</view>
    <button open-type="getPhoneNumber" plain="true" @getphonenumber="getPhoneNumber">获取电话</button>
  </view>
</template>

<script setup>
import { ref, reactive, toRefs, onMounted, getCurrentInstance } from "vue";
import  commonApi from "@/api/modules/common.js"
import { onLoad, onShow } from "@dcloudio/uni-app"
const { code2Session } = commonApi()
const { proxy } = getCurrentInstance();
const hqCode = () => {
  uni.login({
    provider: 'weixin',
    success: res => {
      getCode2Session(res.code)
    }
  });
}

const getCode2Session = async(code)=>{
 const [err,res] = await proxy.awaitCatch(code2Session({code}))
}

const getPhoneNumber = (res)=>{ // 获取手机号
	console.log(res)
}

onShow(options => {
  console.log("page show", options)
})
</script>

<style>
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.logo {
  height: 200rpx;
  width: 200rpx;
  margin-top: 200rpx;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 50rpx;
}

.text-area {
  display: flex;
  justify-content: center;
}

.title {
  font-size: 36rpx;
  color: #8f8f94;
}
</style>
